<%@ page import="java.sql.*" %>
<% Class.forName("com.mysql.jdbc.Driver");

String url, sql;
Connection conn;
PreparedStatement ps;

String id = request.getParameter("id").trim();

try 
{
	Class.forName("com.mysql.jdbc.Driver");
	url = "jdbc:mysql://localhost/student_db";
	conn = DriverManager.getConnection(url, "root", "");

	sql = "DELETE FROM student WHERE id =" + id;
	ps = conn.prepareStatement(sql);
	ps.executeUpdate();
	
	response.sendRedirect("http://localhost:8080/Student/Main.jsp");	

} 
catch (ClassNotFoundException cnfe) 
{
		out.println("" + cnfe);
}
catch (SQLException sqle)
{
		out.println("" + sqle);
}
  
%>